V2EX  ›  英汉词典
Enqueued related words: Type Annotation, Unification

Type Inference

定义 Definition

类型推断:在编译或解释过程中,由编程语言的编译器/解释器根据表达式、变量用法与上下文,自动推导变量、函数返回值等的类型,从而减少或免除显式类型标注(type annotation)。常见于静态类型语言(如 Haskell、Rust、Scala 等),也可能出现在带有类型提示的语言工具链中。

发音 Pronunciation (IPA)

/taɪp ˈɪnfərəns/

例句 Examples

Type inference can often figure out the variable’s type automatically.
类型推断通常可以自动判断变量的类型。

In languages with strong static typing, type inference improves readability while still catching many errors at compile time.
在强静态类型语言中,类型推断既能提升代码可读性,又能在编译期捕获许多错误。

词源 Etymology

type 源自希腊语 typos(印记、模子、范型),经拉丁语与法语进入英语,常引申为“类别/类型”。inference 源自拉丁语 inferre(带入、引出、推论),在英语中表示“由证据或已知信息推导结论”。合起来,type inference 字面即“对类型进行推导”。

相关词 Related Words

文学/著作作品 Literary Works

  • Types and Programming Languages(Benjamin C. Pierce)
  • Programming Language Pragmatics(Michael L. Scott)
  • Compilers: Principles, Techniques, and Tools(Aho / Lam / Sethi / Ullman,“龙书”)
  • The Rust Programming Language(Klabnik & Nichols,常讨论类型推断与泛型)
  • Haskell 98 Language and Libraries: The Revised Report(讨论以 Hindley–Milner 为核心的类型推断思想)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1072 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 17:44 · PVG 01:44 · LAX 09:44 · JFK 12:44
♥ Do have faith in what you're doing.